Bottom Extraction Factoring error handling out of functional programs

نویسنده

  • Jan-Willem Maessen
چکیده

Many utility functions in a functional programming language consist of just a few lines of code. They are written with the expectation that they will be inlined and heavily optimized. For many of these functions, the size of the function being inlined is dominated by the size of code required to signal an error if the inputs are inconsistent. In this paper we describe bottom extraction, a simple technique which mitigates this problem. Using a combination of type information and strictness information, we can easily identify expressions which are devoted to error handling (semantically bottom). Such a bottom expression is enlarged to encompass as much code as possible by a set of local rules. Bottom regions are extracted and hoisted to the top level of the program. Bottom extraction greatly reduces code bloat in the presence of inlining by reducing the size of inlined code. In addition, it provides a simple and fast test to identify error handling code in the rest of the compiler, enabling us to easily perform program transformations around expressions which are semantically bottom. Bottom extraction is a simple but important part of our compiler for pH, and markedly improves every aspect of the compiler’s behavior.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Adaptation of Functional Object Programs

This position paper proposes certain program transformations facilitating reuse of higher-order functional programs. According to the terminology of AOP (aspect-oriented programming; [5, 1, 2]), we use functional programming languages as component languages and we represent aspects as program transformations. Our illustrative examples are concerned with adapting interpreter fragments to cope wi...

متن کامل

Automatically Detecting Error Handling Bugs Using Error Specifications

Incorrect error handling in security-sensitive code often leads to severe security vulnerabilities. Implementing correct error handling is repetitive and tedious especially in languages like C that do not support any exception handling primitives. This makes it very easy for the developers to unwittingly introduce error handling bugs. Moreover, error handling bugs are hard to detect and locate ...

متن کامل

Optimizing Clause Resolution: Beyond Uni cation Factoring

While clause resolution is central to logic programming, practical eeorts to optimize resolution have largely concerned eecient clause indexing. One recent exception is Uniication Factoring 5], which optimizes backtracking through clause heads. Here we consider the problem of optimizing clause resolution in a more general setting than Uniication Factoring. One fundamental change is to use mode ...

متن کامل

Optimizing Clause Resolution: Beyond Unification Factoring

While clause resolution is central to logic programming, practical eeorts to optimize resolution have largely concerned eecient clause indexing. One recent exception is Uniication Factoring 5], which optimizes backtracking through clause heads. Here we consider the problem of optimizing clause resolution in a more general setting than Uniication Factoring. One fundamental change is to use mode ...

متن کامل

Mobile Robot Navigation Error Handling Using an Extended Kalman Filter

Obviously navigation is one of the most complicated issues in mobile robots. Intelligent algorithms are often used for error handling in robot navigation. This Paper deals with the problem of Inertial Measurement Unit (IMU) error handling by using Extended Kalman Filter (EKF) as an Expert Algorithms. Our focus is put on the field of mobile robot navigation in the 2D environments. The main chall...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 1999